package com.example.usercenterbackend.common;

/**
 * 错误码枚举类
 * 用于定义系统中各种错误情况的编码、消息和描述
 */
public enum ErrorCode {

    SUCCESS(0, "成功", ""),
    PARAMS_ERROR(40000, "请求参数错误", ""),
    NULL_ERROR(40001, "请求数据为空", ""),
    NOT_LOGIN(40100, "未登录", ""),
    NO_AUTH(40101, "无权限", ""),
    SYSTEM_ERROR(50000, "系统内部异常", ""),
    OPERATION_ERROR(50001, "操作失败", "");

    private final int code;
    private final String message;
    private final String description;

    /**
     * 错误码构造函数
     * @param code 错误码值
     * @param message 错误消息
     * @param description 错误描述
     */
    ErrorCode(int code, String message, String description) {
        this.code = code;
        this.message = message;
        this.description = description;
    }

    /**
     * 获取错误码
     * @return 错误码值
     */
    public int getCode() {
        return code;
    }

    /**
     * 获取错误消息
     * @return 错误消息
     */
    public String getMessage() {
        return message;
    }

    /**
     * 获取错误描述
     * @return 错误描述
     */
    public String getDescription() {
        return description;
    }
}

